package edu.zut.cs.software.example.clazz.service;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import edu.zut.cs.javaee.dream.base.service.GenericGenerator;
import edu.zut.cs.software.example.clazz.domain.Grade;



/**
 * 
 * @author 42276
 *
 */
public class GradeGenerator extends GenericGenerator {

	@Autowired
	GradeManager gradeManager;

	@Test
	public void testGeneration() {
		for (int i = 0; i < 10; i++) {
			Grade g = new Grade();
			g.setGrade_teacher("孙老师_" + i);
			this.gradeManager.save(g);
			List<Grade> list = new ArrayList<Grade>();
			for (int j = 0; j < 10; j++) {
				Grade grade = new Grade();
				grade.setGrade_teacher("周老师_" + i + "_" + j);
				grade.setParent(g);
				list.add(grade);
			}
			this.gradeManager.save(list);
		}

	}
}
